<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="/favicon.ico" rel="icon">
    <title>{$title}|后台管理中心</title>
    <meta name="keywords" content="{$keywords}"/>
    <meta name="description" content="{$description}"/>
    <link rel="stylesheet" href="{__LIBS__}layui/css/layui.css"/>
    <link rel="stylesheet" href="{__MODULE__}admin.css?v=318"/>
    <link rel="stylesheet" href="{__CSS__}sf-style.css"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="page-no-scroll">

<div class="layui-layout layui-layout-admin">
    <!-- 头部 -->
    <div class="layui-header">
        <div class="layui-logo">
            <img src="{__IMG__}logo.png"/>
            <cite> {$title}</cite>
        </div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="message" title="消息">
                    <i class="layui-icon layui-icon-notice"></i>
                    <span class="layui-badge-dot"></span><!--小红点-->
                </a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>
            </li>
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
            </li>
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="lockScreen" title="锁屏"><i class="layui-icon layui-icon-password"></i></a>
            </li>


            <li class="layui-nav-item" lay-unselect>
                <a>
                    <img src="{$userInfo['img']}" class="layui-nav-img">
                    <cite>{$userInfo['username']}</cite>
                </a>
                <dl class="layui-nav-child">
                    <dd lay-unselect>
                        <a ew-href="{:url('/MyInfo/index')}">个人中心</a>
                    </dd>
                    <dd lay-unselect>
                        <a ew-href="{:url('/Index/editPassword')}">修改密码</a>
                    </dd>
                    <hr>
                    <dd lay-unselect>
                        <a lay-filter="logout" lay-submit>退出登录</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
            </li>

        </ul>
    </div>

    <!-- 侧边栏 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree arrow2" lay-filter="admin-side-nav" lay-accordion="true" lay-shrink="_all">
            {volist name="menuList" id="val" key="key"}
            {if $val['url'] == '#'}
                {if isset($val['children']) && !empty($val['children'])}
                <li class="layui-nav-item">
                    <a><i class="layui-icon {$val['icon']}"></i>&emsp;<cite>{$val.name}</cite></a>

                    <dl class="layui-nav-child">
                    {volist name='val.children' id='vo' key='ko'}
                        {if isset($vo['children']) && !empty($vo['children'])}
                        <dd>
                            <a>{$vo['name']}</a>
                            {volist name='vo.children' id='v' key='k'}
                                <dl class="layui-nav-child">
                                    <dd><a lay-href="{:url('/'.$v['url'])}">{$v['name']}</a></dd>
                                </dl>

                            {/volist}
                        </dd>
                        {else}
                        <dd><a lay-href="{:url('/'.$vo['url'])}">{$vo.name}</a></dd>
                        {/if}
                    {/volist}
                    </dl>
                </li>
                {/if}
            {else}
                <li class="layui-nav-item">
                    <a lay-href="{:url('/'.$val['url'])}" ><i class="layui-icon {$val['icon']}"></i>&emsp;<cite>{$val['name']}</cite></a>
                </li>
            {/if}
            {/volist}
            </ul>
        </div>
    </div>

    <!-- 主体部分 -->
    <div class="layui-body"></div>
    <!-- 底部 -->
</div>

<!-- 加载动画 -->
<div class="page-loading">
    <div class="signal-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>

<script type="text/javascript" src="{__LIBS__}layui/layui.js"></script>
<script type="text/javascript" src="{__JS__}common.js?v=318"></script>
<script>
    layui.use(['index', 'form', 'admin', 'notice'], function () {
        var $ = layui.jquery;
        var form = layui.form;
        var admin = layui.admin;
        var notice = layui.notice;
        var index = layui.index;

        // 默认加载主页
        index.loadHome({
            menuPath: '{:url("/Index/main")}',
            menuName: '<i class="layui-icon layui-icon-home"></i>'
        });
        form.on('submit(logout)', function () {
            parent.layui.admin.confirm('确认退出登录吗？', function (index) {
                notice.msg('正在退出登录中..', {icon: 4, close: true});
                $.ajax({
                    type: "POST",
                    url: '{:url("/Index/logOut")}',
                    dataType: "json",
                    success: function(data) {
                        notice.destroy();
                        if (data.code == 0) {
                            notice.msg("退出登录成功！", {icon: 1, audio:'1'});
                            setTimeout(function (){location.href="{:url('/Login/index')}"},1250);
                        } else {
                            notice.msg(data.msg, {icon: 2, audio:'1'});
                        }
                    },
                    error: function() {
                        notice.destroy();
                        notice.msg("服务器错误！", {icon: 2, audio:'1'});
                    }
                });
                parent.layer.close(index);
            });
        });

    });
</script>
</body>
</html>